<?php

namespace App\Http\Controllers;

use Illuminate\Database\QueryException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;

use Illuminate\Support\Facades\DB;
use App\Tools\Func;
use App\Models\User;
use App\Models\Baogao;

class BaogaoController extends Controller
{
	use Func;
	
	// 列表
	public function list(Request $request)
	{
		$user_id = $request->user_id ?? 1;
		$res = Baogao::with('jiuzhenren')
		->where('jiuzhenren_user_id', $user_id)
		->orderBy('id', 'desc')
		->get();

	    return $this->returnJson(0, 'success', $res);
	}
	
	// get
	public function get(Request $request)
	{
		$res = Baogao::where('id', $request->id)->first();
		
		return $this->returnJson(0, 'success', $res);
	}

	

}
